import datetime
import os

from celery.schedules import crontab
from django.utils import timezone
from celery import Celery

from djangoCeleryTest import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoCeleryTest.settings')

app = Celery('django-celeryTest')

app.conf.beat_schedule = {
    'task-every-three': {
        'task': "users.tasks.every_three_minutes",
        # 'schedule': datetime.timedelta(seconds=180),
        'schedule': crontab(minute='*/15'),
    }
}
app.now = timezone.now
app.config_from_object('django.conf:settings', namespace='CELERY')
# platforms.C_FORCE_ROOT = True
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
